﻿namespace PmfWeb.Core.Cache
{
    ///<summary>
    /// 地址重写类
    ///</summary>
    public class Rewrite
    {
        /// <summary>
        /// 重写节Key
        /// </summary>
        private string _skey;
        /// <summary>
        /// 请求的文件路径
        /// </summary>
        private string _sUrl;
        /// <summary>
        /// 重写的文件路径
        /// </summary>
        private string _tUrl;
        /// <summary>
        /// 匹配的正则表达式
        /// </summary>
        private string _regUrl;
        /// <summary>
        /// 匹配的正则表达式
        /// </summary>
        public string RegUrl
        {
            get { return _regUrl; }
            set { _regUrl = value; }
        }

        /// <summary>
        /// 是否启用该重写节
        /// </summary>
        private bool _isWrite;
        ///<summary>
        /// 构造器
        ///</summary>
        public Rewrite(string skey, string sUrl, string tUrl,string regUrl, bool isWrite)
        {
            this._skey = skey;
            this._sUrl = sUrl;
            this._tUrl = tUrl;
            this._isWrite = isWrite;
            this._regUrl = regUrl;
        }

        ///<summary>
        /// 构造器
        ///</summary>
        public Rewrite() :this("","","","",false)
        {
        }

        /// <summary>
        /// 重写节Key
        /// </summary>
        public string sKey
        {
            get { return _skey; }
            set { _skey = value; }
        }

        /// <summary>
        /// 请求的文件路径
        /// </summary>
        public string SUrl
        {
            get { return _sUrl; }
            set { _sUrl = value; }
        }

        /// <summary>
        /// 重写的文件路径
        /// </summary>
        public string TUrl
        {
            get { return _tUrl; }
            set { _tUrl = value; }
        }

        /// <summary>
        /// 是否启用该重写节
        /// </summary>
        public bool IsWrite
        {
            get { return _isWrite; }
            set { _isWrite = value; }
        }
    }
}